
*******************
* Replication Files - Master dofile
* last updated: 2021-01-11
* Magdalena Larreboure

*******************

clear
set more off


/******* Preliminaries **************/

/* note that this makes use of the following global, which should be defined
 global covidmc_dir	 "[user's path to replication files folder]"
 */
 glo covidmc_dir "/replication_files"
 
 glo dir "$covidmc_dir"
 glo dr "$dir/rawdata"
 glo da "$dir/data"
 glo do "$dir/code"
 glo dtab "$dir/results"
 glo dfig "$dir/results" 

set more off

********************************************************************************************************

					******************* Construct outcomes  *******************	

foreach sample in "KEN1" "KEN2" "KEN3" {

run "$do/1_Construct_`sample'.do"
}

********************************************************************************************************


						******************* Main Table  *******************	

* title: Change in Living Standards During the COVID-19 Crisis in Nine Developing Countries  

* output1: replication_files/results/Main Table.xlsx
* output2: replication_files/results/Inverse Table.xlsx for "COL1" "GHA1" "RWA1" "SLE2" "PHL1" "BFA1"

foreach sample in "BGD1" "BGD4" "BGD5" "KEN1" "KEN2" "KEN3" "COL1" "GHA1" "RWA1" "SLE2" "PHL1" "BFA1" "SLE1" "NPL1" "BGD2" "BGD3" { 

run "$do/2_Export_`sample'.do"

}
********************************************************************************************************

						******************* Figure 1  *******************	
						
* title: Evolution of Key Indicators Over Time
* output: replication_files/results/WeeklyPanels.pdf

foreach sample in "KEN1" "SLE1" {

run "$do/Figure1_`sample'.do"
}
*run Rscript located under "replication_files/code/Figure_1_replication.R"


********************************************************************************************************
					
					    ******************* Figure 2  *******************	
					
* title: Food Insecurity in Bangladesh and Nepal
* output1: replication_files/results/seasonality_graph_BGD.png
* output2: replication_files/results/seasonality_graph_NPL.png

run "$do/Figure_2_replication.do"

********************************************************************************************************

					******************* Representativeness Table (Table S1) *******************	

* title: Survey Representativeness with respect to National and Population Demographics
* output: replication_files/results/Representativeness Table.xlsx

foreach sample in "BGD1" "BGD2" "BGD3" "BGD4" "BGD5" "KEN1" "KEN2" "KEN3" "COL1" "GHA1" "RWA1" "SLE2" "PHL1" "BFA1" "SLE1" "NPL1" { 

run "$do/3_Export_`sample'_RT.do"
}

********************************************************************************************************

					******************* Inverse Table (Table S2) *******************	

* title: Fraction of Respondents Reporting Decrease and Increase in Income
* output: replication_files/results/Inverse Table.xlsx for "BGD1" "BGD2" "BGD3" "BGD4" "BGD5" "SLE1" "NPL1" "KEN1" "KEN2" "KEN3" 

foreach sample in "BGD1" "BGD2" "BGD3" "BGD4" "BGD5" "KEN" "SLE1" "NPL1" {

run "$do/4_Export_`sample'_IT.do"
}

********************************************************************************************************

						******************* Figure S1  *******************	
						
* title: Results from Table 2 with Standard Errors
* output: replication_files/results/Tab_2_Fig.pdf

*run Rscript located under "replication_files/code/Figure_S1_replication.Rmd"


********************************************************************************************************

					******************* Figure S2 *******************	

* title: Recall and Contemporaneous pre-COVID-19 Survey Responses
* output1: replication_files/results/recall_NPL.png
* output2: replication_files/results/recall_BGD.png

run "$do/Figure_S2A_replication.do"
run "$do/Figure_S2B_replication.do"
